package chapter7;

import java.util.StringJoiner;

public class sort16 {
    public static void main(String[] args) {
        //1.创建一个对象，并指定中间的间隔符号
        StringJoiner sj = new StringJoiner("---");//2.添加元素
        sj.add("aaa").add("bbb").add("ccc");//3.打印结果
        System.out.println(sj);//aaa---bbb---ccc

        //1.创建对象
        StringJoiner sj2 = new StringJoiner(", ","[","]");//2.添加元素
        sj2.add("aaa").add("bbb").add("ccc");int len = sj2.length();System.out.println(len);//15
//3.打印
        System.out.println(sj2);//[aaa, bbb, ccc]
        String str = sj2.toString();System.out.println(str);//[aaa, bbb, ccc]
    }
}
